package com.xk.springboot.config;


import com.xk.springboot.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器的注册配置
 * @author:Teacher黄
 * @date:Created at 2020/04/10
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {


    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册
        registry.addInterceptor(new LoginInterceptor())
                // 定义拦截路径
                .addPathPatterns("/**")
                // 定义放行路径
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/async/**");

    }


}
